//开关组件代码
<template>
	<view @click='change'>{{result?'开':'关'}}</view>
</template>
<script>
	export default {
		props: {
			result: {
				type: Boolean,
				default: false
			},
		},
		methods: {
			change() {
				this.result = !this.result;
			}
		},
		data() {
			return {
				myResult: this.result,
			}
		},
		watch: {
			result(val) {
				console.log("inner result" + val);
				this.myResult = val
			},
			myResult(val) {
				this.$emit('toFather', val)
			}
		}
	}
</script>
